package lg.minecraft.plugin.pokemonmenu.command;

import lg.minecraft.plugin.library.command.CommandContext;
import lg.minecraft.plugin.library.command.LGCommand;
import lg.minecraft.plugin.library.command.SubCommand;
import lg.minecraft.plugin.pokemonmenu.LGPokemonMenu;

/**
 * @author langle__
 * @version 1.0
 */
public class MainCommand extends LGCommand {

    public MainCommand() {
        super(LGPokemonMenu.getInstance(), "lgpokemonmenu", "pm", "lgpm");
    }

    @Override
    public String getPermission() {
        return "LGPokemonMenu.command";
    }

    @Override
    public void onCommand(CommandContext context) {
        SubCommand command = getSubCommandMap().get("open");
        if (LGPokemonMenu.getMainConfig().isCommandMain() && context.isPlayerSender() && command.isPermission(context.getSender())) {
            command.onCommand(context);
        } else {
            super.onCommand(context);
        }
    }

}
